package com.jsbb.service.log;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.jsbb.core.PageVo;
import com.jsbb.dto.log.LogApiQueryDto;
import com.jsbb.mapper.log.LogApiMapper;
import com.jsbb.vo.log.LogApiVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 接口日志Service
 *
 * @author jsbb
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class LogApiService {

    @Autowired
    private LogApiMapper logApiMapper;

    public PageVo<LogApiVo> list(LogApiQueryDto queryDto) {
        Page page = PageHelper.startPage(queryDto.getPageNo(), queryDto.getPageSize());
        List<LogApiVo> logVoList = logApiMapper.selectByCondition(queryDto);
        return new PageVo((int) page.getTotal(), logVoList);
    }
}
